NAME = paper
FIGURES = 
IMAGES = 
GRAPHS = 

all: $(NAME).pdf

$(NAME).pdf: $(NAME).tex ${FIGURES} ${GRAPHS} ${IMAGES}
	pdflatex $(NAME)
	pdflatex $(NAME)
	pdflatex $(NAME)

$(NAME).dvi: $(NAME).tex ${FIGURES} ${GRAPHS} ${IMAGES}
	latex $(NAME)
	#bibtex $(NAME)
	latex $(NAME)
	latex $(NAME)

%.gif: %.eps
	convert $< $@

%.eps: %.fig
	fig2dev -L eps $< $@

%.eps: %.gnuplot
	gnuplot <$< >$@

cclpapers.bib:
	wget -O $@ http://www.cse.nd.edu/~ccl/research/papers/bibtex.php

clean:
	rm -f *~ $(NAME).aux $(NAME).bbl $(NAME).blg $(NAME).dvi $(NAME).ps $(NAME).pdf $(NAME).log figures/*.eps plots/*.eps *.bak #cclpapers.bib
